package com.eastfair.auth.controller;

import com.eastfair.auth.dto.OrganizationDTO;
import com.eastfair.auth.service.AudienceOrganizationService;
import com.eastfair.core.base.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 公司controlelr
 *
 * </p>
 *
 * @author ligang
 * @date 2021-07-16
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/audienceOrganization")
@Api(value = "companyOrganization", tags = "")
public class AudienceOrganizationController {


    @Autowired
    AudienceOrganizationService audienceOrganizationService;

    /**
     * 添加用户到观众分类
     * @param organizationDTO 组织实体DTO
     * @return
     */
    @ApiOperation(value = "添加用户到观众分类", notes = "添加用户到观众分类")
    @PostMapping("/addUserOfAudience")
    public R addUserOfAudience(@RequestBody @Validated({OrganizationDTO.addUserOfAudience.class }) OrganizationDTO organizationDTO) {
        return audienceOrganizationService.addUserOfAudience(organizationDTO.getProjectId(),organizationDTO.getUserIds());
    }


}
